<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap{
	public function __construct($self) {
		parent::__construct($self);
		Zend_Loader::loadClass('Zend_Controller_Front');
		Zend_Loader::loadClass('Zend_Config_Ini');
		Zend_Loader::loadClass('Zend_Registry');
		Zend_Loader::loadClass('Zend_Db');
		Zend_Loader::loadClass('Zend_Db_Table');
		Zend_Loader::loadClass('Zend_Auth');
		Zend_Loader::loadClass('Zend_Auth_Adapter_DbTable');
		Zend_Loader::loadClass('Zend_Form');
		Zend_Loader::loadClass('Zend_Form_Element_Text');
		Zend_Loader::loadClass('Zend_Form_Element_Password');
		Zend_Loader::loadClass('Zend_Form_Element_Submit');
		Zend_Loader::loadClass('Zend_Form_Element_Select');
		Zend_Loader::loadClass('Zend_Form_Element_Image');
		Zend_loader::loadClass('Zend_Filter_Alpha');
		Zend_Loader::loadClass('Zend_Filter_StripTags');
		Zend_Loader::loadClass('Zend_Filter_StringTrim');
		Zend_Loader::loadClass('Zend_Controller_Action');
		Zend_loader::loadClass('Zend_Mail');
		Zend_loader::loadClass('Zend_Mail_Transport_Smtp');
		Zend_loader::loadClass('Zend_Filter_Alpha');
		Zend_Loader::loadClass('Zend_Translate');
		Zend_Loader::loadClass('Zend_File_Transfer_Adapter_Http');
    	Zend_Loader::loadClass('Zend_File_Transfer');

		Zend_Loader::loadClass('BaseController');
		Zend_loader::loadClass('MailController');
		Zend_Loader::loadClass('Pessoa');
		Zend_Loader::loadClass('Fisica');
		Zend_Loader::loadClass('Juridica');
		Zend_Loader::loadClass('Menu');
		Zend_Loader::loadClass('Evento');
		Zend_Loader::loadClass('Pais');
		Zend_Loader::loadClass('Estado');
    	Zend_Loader::loadClass('Cidade');
    	Zend_Loader::loadClass('RamoAtuacao');
    	Zend_Loader::loadClass('CategoriaParticipante');
    	Zend_Loader::loadClass('AcessoEvento');
    	Zend_Loader::loadClass('LocalEvento');
		Zend_Loader::loadClass('Funcionario');

    	Zend_Loader::loadClass('Autenticacao');
    	Zend_Loader::loadClass('Perfil');
    	Zend_Loader::loadClass('GrupoAcesso');
    	Zend_Loader::loadClass('UtilController');
    	Zend_Loader::loadClass('Sexo');
    	Zend_Loader::loadClass('Status');
    	Zend_Loader::loadClass('Civil');
    	Zend_Loader::loadClass('Funcionario');
		Zend_Loader::loadClass('Fumtur');
    	Zend_Loader::loadClass('Evento');
    	Zend_Loader::loadClass('IntegranteFumtur');
    	Zend_Loader::loadClass('Contato');
    	Zend_Loader::loadClass('Expositor');
    	Zend_Loader::loadClass('Login');
    	Zend_Loader::loadClass('StringFormat');
    	Zend_Loader::loadClass('AlertaErro');
    	Zend_Loader::loadClass('ModelController');
    	
	}

	protected function _initConnection(){
	    $options = $this->getOption('resources');
	    $db_adapter = $options['db']['adapter'];
	    $params     = $options['db']['params'];

	    try{
	        $db = Zend_Db::factory($db_adapter, $params);
	        $db->getConnection();

	        // Registra a $db para que se torne acessível em toda app
	        $registry = Zend_Registry::getInstance();
	        $registry->set('db', $db);

	    }catch( Zend_Exception $e){
	        echo "Estamos sem conexão ao banco de dados neste momento. Tente mais tarde por favor.";
	        exit;
	    }
	}
}